package com.metrology.app.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

public class AdminResource implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -7644346936196462910L;
	private String id;
	private String name;
	private String type;
	private String value;
	private String module;
	private String description;
	private boolean enabled;
	private Date gmtCreated;
	private Date gmtModified;
	
	private boolean isResource = false;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getModule() {
		return module;
	}

	public void setModule(String module) {
		this.module = module;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public Date getGmtCreated() {
		return gmtCreated;
	}

	public void setGmtCreated(Date gmtCreated) {
		this.gmtCreated = gmtCreated;
	}

	public Date getGmtModified() {
		return gmtModified;
	}

	public void setGmtModified(Date gmtModified) {
		this.gmtModified = gmtModified;
	}
	
	//设置用户的角色
	public static void isResource(List<AdminResource> resources, List<AdminResource> roleResources) {
		if(resources==null||roleResources==null || resources.size()==0 || roleResources.size()==0){
			return;
		}
		for(AdminResource r : resources){
			for(AdminResource rr : roleResources){
				if(rr.getId().equals(r.getId())){
					r.isResource = true;
				}
			}
		}
	}
	
	public boolean getIsResource() {
		return isResource;
	}

}
